<template>
  <div class="page-common-layout">
    <div class="page-common-content">
      <tool-bar
        @search="$refs.table.refresh(true)"
        @reset="
          () => {
            (queryParam = {}), $refs.table.refresh(true);
          }
        "
      >
        <template slot="toolBtn" slot-scope="scope">
          <a-button
            class="cu-btn-primary"
            icon="plus"
            @click="handleAdd()"
            >{{$ct("add","新增")}}</a-button
          >
					<!-- <CombinedQuery
						:columns="columns"
						 @refresh="(e) => {queryParam.advanceFilter = e, $refs.table.refresh(true)}"
					></CombinedQuery> -->
          <!-- <a-button
            class="cu-btn-default"
            icon="edit"
            @click="handleEdit()"
            v-action:configEditDialog
            >编辑</a-button
          > -->
        </template>
        <template slot="toolForm">
          <a-form-item :label="$ct('name','名称')">
            <a-input v-model="queryParam.name" :placeholder="$ct('name','名称')" />
          </a-form-item>
        </template>
      </tool-bar>
      <EdataGrid
        ref="table"
        :columns="columns"
        :url="url"
        rowKey="uuid"
        :queryParam="queryParam"
        :showRowSelect="false"
      >
      </EdataGrid>
    </div>
  </div>
</template>
<script>
import { EdataGrid } from "@/components";
import { eDataGridMixin } from "@/mixins/eDataGridMixin";
import CombinedQuery from "@/components/TopVUI/custom/CombinedQuery";
export default {
  name: "Table",
  mixins: [eDataGridMixin],
  components: { EdataGrid, CombinedQuery },
  filters: {
    sexStr(val) {
      switch (Number(val)) {
        case 0:
          return "女";
        case 1:
          return "男";
      }
    },
  },
  data() {
    return {
      columns: [
        {
          title: "名称",
          dataIndex: "name",
          width: 200,
          type: "text",
          option: {
            rules: [{ required: true, message: "必填" }],
          },
          scopedSlots: { customRender: "renderName" },
        },
        {
          title: "代码",
          dataIndex: "code",
          width: 200,
          type: "text",
          option: {
            rules: [
            { required: true, message: "必填" },
            {pattern: /^[A-Za-z0-9]{8,50}$/,message: "只能是数字和字母,且长度要在8-50位之间",},
          ],
          },
          scopedSlots: { customRender: "renderCode" },
        },
        {
          title: "值",
          dataIndex: "value",
          type: "text",
          // width: 200,
          scopedSlots: { customRender: "renderValue" },
          option: {
            rules: [{ required: true, message: "必填" }],
          },
        },
        {
          title: "描述",
          dataIndex: "description",
          type: "text",
          scopedSlots: {
            customRender: "renderDescription",
          },
          width: 200,
        },
        {
          title: "操作",
          width: 150,
          dataIndex: "action",
          align: "center",
          scopedSlots: {
            customRender: "renderAction",
          },
        },
      ],
      visible: false,
      confirmLoading: false,
      mdl: null,
      // 查询参数
      queryParam: {},
      url: {
        getPageSet: "/system/config/getOtherPageSetData",
        save: "/system/config/saveOtherData",
        update: "/system/config/update",
        deleteBatch: "/system/config/deleteBatch",
      },
    };
  },
  methods: {},
};
</script>

<style scoped lang="less">
.table {
  background-color: @base-bg-color;
  padding: 24px;
}
</style>
